<?php
$rootUrl = Yii::app()->params['document_root'];
$storeUrl = $rootUrl . Yii::app()->params['upload_url'] . 'store/default_images/';
?>

<?php 
$controllerId = Yii::app()->controller->id;
if ( $controllerId == 'doiNguBs' ) :
?>
<div class="leftMenuT2Wrapper">
    <h1 class="txtColor1">CÁC CHUYÊN KHOA</h1>
    <ul class="ulNone">
        <?php
        //initialize
        $modelNews = new FNews();
        $list = $modelNews->getTop(12, 50);
        $maxRepeat = count($list);
        
        //str pattenrs
        $sPatter1 = '<li><a href="%s" class="link lnColor4">%s</a></li>';
        $sPatter2 = '<li><a href="%s" class="link lnColor4 lnColor4Acitve">%s</a></li>';

        if ( $maxRepeat ) {
            //detect current item
            $curPage = $list['0']->id . '-' . $list['0']->title_seo;
            if ( Yii::app()->controller->action->id == 'detail') {
                $curPage = Yii::app()->request->getQuery('page', $curPage);
            }
            
            //print item
            for ($i = 0; $i < $maxRepeat; $i++ ) {
                $page = $list[$i]->id . '-' . $list[$i]->title_seo;
                $link = $this->createUrl('detail', array('page' => $page));

                if ( $page != $curPage) {
                    printf($sPatter1, $link, $list[$i]->title);
                } else {
                    printf($sPatter2, $link, $list[$i]->title);
                }
            }
        }
        ?>
    </ul>
</div>
<div class="blockHeight20"></div>
<?php endif ?>

<div class="leftMenuT1Wrapper">
    <?php
    $serviceMenu = Yii::t('app', 'service_menu');
    $count = 1;
    $curAction = Yii::app()->controller->action->id;
    
    foreach ($serviceMenu as $key => $value) :
        $link = Yii::app()->createUrl('services/' . $key);
    ?>
    <div class="leftMenuT1Row">
        <a href="<?php echo $link ?>" class="link">
            <img src="<?php echo $storeUrl . "service_$count.jpg" ?>" />
        </a>
        <h3 class="txtColor2">
            <a href="<?php echo $link ?>" class="link lnColor2">
                <?php echo $value ?>
            </a>
        </h3>
        <?php
        if ( $key == $curAction ) echo '<div class="active"></div>';
        ?>
    </div>
    <div class="clear"></div>
    <?php
    $count++;
    endforeach;
    ?>
</div>